import {
    DIC
} from '@/const/dic';
import {
    parseTime
} from '../formatter';
import Store from '../../store/';
const isAdmin = Store.state.user.userInfo.roleId == 100;
const allPermission = Store.state.user.permission;
export const adminTableOption = {
    border: true,
    index: true,
    selection: true,
    calcHeight: 350,
    menu: true,
    menuAlign: "center",
    searchBtn: true,
    labelWidth: 120,
    searchClearable: false,
    tip: false,
    selectClearBtn: false,
    clearable: false,
    searchResetBtn: false,
    refreshBtn: true,
    addBtn: isAdmin || !!allPermission['/admin/user/add'],
    dialogWidth: '800px',
    height: "auto",
    dialogHeight: 'auto',
    menuWidth: 320,
    editBtn: isAdmin || !!allPermission['/admin/user/edit'],
    viewBtn: isAdmin || !!allPermission['/admin/user/view'],
    delBtn: isAdmin || !!allPermission['/admin/user/remove'],
    column: [{
            "label": "账号",
            "prop": "Username",
            "search": true,
            editDisabled: true,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": true,
                "message": "请输入账号",
                "trigger": "blur"
            }]
        },
        {
            "label": "姓名",
            "prop": "Realname",
            "search": true,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": true,
                "message": "请输入姓名",
                "trigger": "blur"
            }]
        },
        {
            "label": "手机号码",
            "prop": "Telephone",
            "search": false,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": true,
                "message": "请输入手机号码",
                "trigger": "blur"
            }]
        },
        {
            "label": "角色",
            "prop": "RoleId",
            "search": true,
            "type": "select",
            "fixed": false,
            placeholder: '请选择角色',
            "width": "auto",
            props: {
                label: 'label',
                value: 'value'
            },
            dicUrl: '/role/list-all',
            dicMethod: 'post',
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": true,
                "message": "请选择角色",
                "trigger": "blur"
            }]
        },
        {
            "label": "状态",
            "prop": "Status",
            "search": true,
            "type": "select",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            dicData: DIC.STATE,
            "readonly": false,
            "span": 12,
            "display": false
        },

        {
            "label": "最后登录IP",
            "prop": "LastLoginIp",
            "search": false,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": false
        },
        {
            "label": "最后登录时间",
            "prop": "LastLoginTime",
            "search": false,
            formatter: parseTime,
            "type": "datetime",
            "fixed": false,
            "width": "160",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": false
        },
        {
            "label": "创建时间",
            "prop": "CreateTime",
            "search": false,
            "type": "datetime",
            "fixed": false,
            formatter: parseTime,
            "width": "160",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": false
        },
        {
            "label": "修改时间",
            "prop": "ModifyTime",
            "search": false,
            "type": "datetime",
            "fixed": false,
            "width": "160",
            formatter: parseTime,
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": false
        },
        {
            "label": "地区",
            "prop": "Area",
            "search": true,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": false,
                "message": "请输入地区",
                "trigger": "blur"
            }]
        },
        {
            "label": "银行名称",
            "prop": "BankName",
            "search": false,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": false,
                "message": "请输入银行名称",
                "trigger": "blur"
            }]
        },
        {
            "label": "开户账号",
            "prop": "BankAccount",
            "search": false,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": false,
                "message": "请输入开户账号",
                "trigger": "blur"
            }]
        },
        {
            "label": "开户支行",
            "prop": "BankBranch",
            "search": false,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": false,
                "message": "请输入开户支行",
                "trigger": "blur"
            }]
        },
        // {
        //     "label": "微信收款码",
        //     "prop": "WxReceiptCode",
        //     "search": false,
        //     "type": "upload",
        //     "fixed": false,
        //     "width": "auto",
        //     "minWidth": "120",
        //     "readonly": false,
        //     "span": 12,
        //     "display": true,
        //     "rules": [{
        //         "required": true,
        //         "message": "请输入微信收款码",
        //         "trigger": "blur"
        //     }]
        // },

        {
            "label": "刷手数量",
            "prop": "ScalperNum",
            "search": false,
            "type": "number",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": false
        },
        {
            "label": "备注",
            "prop": "Note",
            "search": false,
            "type": "textarea",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 24,
            "display": true
        }
    ]
};
